package com.olt.dao.user;

import com.olt.domain.user.RolePower;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@SuppressWarnings("MybatisXMapperMethodInspection")
public interface IRolePower extends JpaRepository<RolePower,Long> {

    @Modifying
    @Query("delete from RolePower r where r.roleId=?1")
    void deleteByRoleId(Long roleId);

    @Query("select new java.lang.String( p.powerName) from  RolePower r left join OltPower p on p.powerId=r.powerId where r.roleId=?1")
    List<String> findIdByRoleId(Long roleId);


}
